Shader "custom/UI/Bg"
{
    Properties
    {
        _Color("Color", Color) = (1,1,1,1)
        _MainTex("Base (RGB)", 2D) = "white" {}
    }

        SubShader
    {
        Tags { "Queue" = "Overlay" }
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            struct appdata_t
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            sampler2D _MainTex;
            fixed4 _Color;

            v2f vert(appdata_t v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }


            float CalCol(float len, float speed, float range)
            {
                float offset = -_Time.y * speed;
                len += offset;
                len %= range;
                len /= range;
                float s = sin(len * 3.141526 * 2) * 0.5 + 0.5;
                return s;

            }
            fixed4 frag(v2f i) : SV_Target
            {
                float2 sc = i.vertex.xy / i.vertex.w - _ScreenParams.xy / 2;
                float len = length(sc);

                float speed = 100;
                float range = 100;


                return fixed4(CalCol(len, 10, 100) * 0.5, CalCol(len, 20, 100) * 0.5, 0, 1);
            }


            ENDCG
        }
    }
}